/*
 * BSM6.0
 *
 * Copyright 2012-2013 (C) SINODATA CO., LTD. All Rights Reserved.
 */
package com.sinodata.bsm.cicp.service;

import java.util.HashMap;
import java.util.List;

import org.apache.log4j.Logger;

import com.sinodata.bsm.cicp.finder.Finder;

/**
 * <p>
 * Description: 
 * </p>
 *
 * @author tangli
 * @version 1.0

 * <p>
 * History: 
 *
 * Date                     Author         Version     Description
 * ---------------------------------------------------------------------------------
 * 2012-5-22 上午9:38:53          tangli         1.0         To create
 * </p>
 *
 * @since 
 * @see     
 */
public class ResFindService {
    private static Logger logger = Logger.getLogger(ResFindService.class);

    /**
     * 
     */
    public ResFindService() {
    }

    /**
     * 资源发现的service
     * @param ip 要发现的资源IP
     * @param params 资源发现的参数配置
     * @param className 资源发现的类名
     * @return
     */
    public List<String[]> find(String ip, HashMap params, String className) {
        try {
            Finder finder = (Finder) Class.forName(className).newInstance();
            return finder.find(ip, params);
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("failed to find res,ip=" + ip + ",className=" + className);
            logger.error(e);
        }
        return null;
    }
}
